
<template>
  <el-popover placement="top" width="160" v-model="visible">
    <p>{{title}}</p>
    <div style="text-align: right; margin: 0">
      <el-button size="mini" type="text" @click.stop.prevent="noFun">{{cancelText}}</el-button>
      <el-button type="primary" size="mini" @click.stop.prevent="okFun">{{okText}}</el-button>
    </div>
    <slot slot="reference"></slot>
  </el-popover>
</template>
<script>
export default {
    // 微小弹窗
    //用法示例：src/page/inquiryRegister/list.vue
  name: 'popover',
  props: {
    cancelText: {
      type: String,
      default: "取消"
    }, //取消按钮文字
    okText: {
      type: String,
      default: "确定"
    }, //确定按钮文字
    title: String, //确认框的描述
    onCancel: Function, //点击取消的回调
    onConfirm: Function //点击确认的回调
  },  
  data(){
    return { 
        visible:false
    }
  },
  methods: {
    noFun(){//取消函数
        this.visible=false;
        this.$emit('onCancel');
    },
    okFun(){//确定函数
        this.visible=false;
        this.$emit('onConfirm');
    }
  }
};
</script>

<style lang="scss" scoped>
</style>

